package com.cuz.daileetcode;


public class Day18_2 {

    static class S1 {
        public static void main(String[] args) {
            int i = removeElement(new int[]{0, 1, 2, 2, 3, 0, 4, 2}, 2);

        }

        public static int removeElement(int[] nums, int val) {
            if (nums == null || nums.length == 0) {
                return 0;
            }
            int first = 0;
            for (int second = 0; second < nums.length; second++) {
                if (nums[second]!=val){
                    nums[first]=nums[second];
                    first++;
                }
            }
//            System.out.println(Arrays.toString(nums));
            return first;
        }
    }
}
